<template>
  <div class="sex">
    <van-radio-group v-model="radio">
      <van-cell-group>
        <van-cell title="男" clickable @click="radio = '0'">
          <template #right-icon>
            <van-radio name="0" />
          </template>
        </van-cell>
        <van-cell title="女" clickable @click="radio = '1'">
          <template #right-icon>
            <van-radio name="1" />
          </template>
        </van-cell>
      </van-cell-group>
    </van-radio-group>
    <van-button plain hairline type="primary" @click="gotopersonal"
      >保存</van-button
    >
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      radio: "",
    };
  },
  mounted() {
    this.radio = this.$route.query.sex;
  },
  methods: {
    gotopersonal() {
      this.$API.user({ sex: this.radio }).then((res) => {
        if (res.data.code == 200) {
          Toast.success(res.data.msg);
          this.$router.push("/personal");
        }
      });
    },
  },
};
</script>
<style lang="scss">
.sex {
  min-height: 99vh;
  background: #f0f2f5;
  box-sizing: border-box;
}
</style>